﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using _3DTools;

namespace CarViewer
{
    /// <summary>
    /// Interaction logic for CarViewer.xaml
    /// </summary>
    public partial class CarControl : UserControl
    {
        Trackball trackball;
        Point currPoint = new Point(0, 0);
        public CarControl()
        {
            InitializeComponent();
            trackball = new Trackball();
            trackball.EventSource = myElement;
            ZAM3DViewport3D.Camera.Transform = trackball.Transform;
           
        }

        public void Reset()
        {
            trackball.Reset();
        }

        public void Move(Point p)
        {
            //Console.WriteLine("x {0} y {1}", p.X * ZAM3DViewport3D.ActualWidth, p.Y * ZAM3DViewport3D.ActualHeight);
            trackball.Track(new Point(p.X * ZAM3DViewport3D.ActualWidth,
                p.Y *ZAM3DViewport3D.ActualHeight));
        }
    }
}
